#!/usr/bin/env python
#
#Uninstalls Ultimate Theme Manager. Lots and lots of rm'ing. How do I get a list of users and their home directories?
#sharkbaitbobby+utm@gmail.com :)
import os
for x in os.environ.items():
	if x[0]=="HOME":
		home = x[1]
	if x[0]=="USER":
		user = x[1]

if user!="root":
	if not "-y" in sys.argv:
		run_sudo = raw_input("You are not currently root. This will only install for you, and not the whole system. Continue? (y/n) ")
		if run_sudo in ("n","N","no"):
			print "OK. Exiting. You may want to add sudo before \"python install.py\" to run as root."
			exit()
	
	os.system('rm -r %s/.utm' % home)
	os.system('rm -r %s/.local/utm' % home)

else:
	os.system('rm /usr/bin/ultimate-theme-manager')
	os.system('rm -r /usr/share/ultimate-theme-manager')
	os.system('rm /usr/share/pixmaps/ultimate-theme-manager.png')
	os.system('rm /usr/share/applications/ultimate-theme-manager.desktop')
	
	for x in os.listdir('/home'):
		os.system('rm -r /home/%s/.utm' % x)


print "Done!\nUltimate Theme Manager uninstalled. :("
